<?php

/**
 * Zonas form base class.
 *
 * @method Zonas getObject() Returns the current form's model object
 *
 * @package    costabravasfr
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 24171 2009-11-19 16:37:50Z Kris.Wallsmith $
 */
abstract class BaseZonasForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'           => new sfWidgetFormInputHidden(),
      'zona'         => new sfWidgetFormTextarea(),
      'localidad_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Localidades'), 'add_empty' => true)),
      'zona_desc_ca' => new sfWidgetFormTextarea(),
      'zona_desc_es' => new sfWidgetFormTextarea(),
      'zona_desc_en' => new sfWidgetFormTextarea(),
      'zona_desc_nl' => new sfWidgetFormTextarea(),
      'zona_desc_fr' => new sfWidgetFormTextarea(),
      'zona_desc_de' => new sfWidgetFormTextarea(),
      'created_at'   => new sfWidgetFormDateTime(),
      'updated_at'   => new sfWidgetFormDateTime(),
      'slug'         => new sfWidgetFormInputText(),
    ));

    $this->setValidators(array(
      'id'           => new sfValidatorDoctrineChoice(array('model' => $this->getModelName(), 'column' => 'id', 'required' => false)),
      'zona'         => new sfValidatorString(array('required' => false)),
      'localidad_id' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Localidades'), 'required' => false)),
      'zona_desc_ca' => new sfValidatorString(array('required' => false)),
      'zona_desc_es' => new sfValidatorString(array('required' => false)),
      'zona_desc_en' => new sfValidatorString(array('required' => false)),
      'zona_desc_nl' => new sfValidatorString(array('required' => false)),
      'zona_desc_fr' => new sfValidatorString(array('required' => false)),
      'zona_desc_de' => new sfValidatorString(array('required' => false)),
      'created_at'   => new sfValidatorDateTime(),
      'updated_at'   => new sfValidatorDateTime(),
      'slug'         => new sfValidatorString(array('max_length' => 255, 'required' => false)),
    ));

    $this->validatorSchema->setPostValidator(
      new sfValidatorDoctrineUnique(array('model' => 'Zonas', 'column' => array('slug')))
    );

    $this->widgetSchema->setNameFormat('zonas[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Zonas';
  }

}
